#include<math.h>
#include<iostream>
using namespace std;

int v[10],vnenul[10],vprim[10];
bool prim(int x);

bool prim(int x)
{ int i,mij;
  bool ok;
mij=int(sqrt(x));
 
 if((x==1) || (x==2))
  { ok=true;
   return ok;
  }
if((x%2==0) && (x>2))
  { ok=false;
   return ok;
  }
for(i=3;i<mij;i=i+2)
if(x%i==0)
   ok=false;
return ok;

}

int main()
{ int i,k=0,j=0;
for(i=0;i<10;i++)
{cout<<"v["<<i<<"]=";
 cin>>v[i];

if(v[i]!=0)
{vnenul[k]=v[i];
 k=k+1;

}
if(prim(v[i]))
{
vprim[j]=v[i];
j=j+1;
}

if(v[i]==0 || !(prim(v[i])))
cout<<"elem nu poate fi nenul sau prim";
}
for(int ii=0;ii<k;ii++)
 cout<<"vn["<<ii<<"]="<<vnenul[ii]<<endl;

for(int iii=0;iii<j;iii++)
 cout<<"vp["<<iii<<"]="<<vprim[iii]<<endl;
return 0;
}
